package net.hn.hnms.biz.safety.location.company.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.api.safety.location.model.CompanyAlarmVo;
import net.hn.hnms.biz.api.safety.location.model.CompanyMonitoringVo;
import net.hn.hnms.biz.api.safety.location.model.CompanyRiskVo;
import net.hn.hnms.biz.api.safety.location.model.PeopleTrendVo;
import net.hn.hnms.biz.api.safety.monitor.model.Indicator;
import net.hn.hnms.biz.safety.location.company.service.CompanyLocationService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 智呈物联 pan'sx
 * 2022/12/20 15:59
 * 1.0 version
 */
@RestController
@RequestMapping("company/riskMonitor/location")
@Api(value = "人员定位控制器", tags = {"人员定位-公司端"})
@RequiredArgsConstructor
public class LocationController {
    private final CompanyLocationService companyLocationService;

    @GetMapping("monitoring")
    @ApiOperation("实时监测")
    public R<CompanyMonitoringVo> monitoring() {
        return R.ok(companyLocationService.monitoring());
    }

    @GetMapping("alarm")
    @ApiOperation("今日报警情况")
    public R<CompanyAlarmVo> alarm(){
        return R.ok(companyLocationService.alarm());
    }

    @GetMapping("risk")
    @ApiOperation("风险统计")
    public R<CompanyRiskVo> risk(@ApiParam("周或月") String type){
        return R.ok(companyLocationService.risk(type));
    }

    @GetMapping("mineInfo")
    @ApiOperation("煤矿信息")
    public R<Indicator> getMineInfo(@ApiParam(required = true) String mineCode){
        return R.ok(companyLocationService.getMineInfo(mineCode));
    }

    @GetMapping("trend")
    @ApiOperation("井下人数趋势")
    @AutoSetMineCode
    public R<PeopleTrendVo> peopleTrend(@ApiParam(value = "月|周") String type, String companyCode) {
        return R.ok(companyLocationService.peopleTrend(type, companyCode));
    }
}
